package com.wyman.test;

import java.util.*;

/**
 * @Author 李伟民
 * @Description
 * @DateTime 2025/1/5 23:35
 */

class KeyNode {

    int key;
    int times;
    int lastTime;

    @Override
    public boolean equals(Object obj) {

        if(obj==null){
            return false;
        } else if (!(obj instanceof  KeyNode)) {
            return false;
        }
        return this.key == ((KeyNode)obj).key;
    }

    @Override
    public int hashCode() {
        return Objects.hash(key);
    }

    public KeyNode(int key,int times,int lastTime){
        this.key = key;
        this.times = times;
        this.lastTime = lastTime;

    }

}


class ValNode {

    int times;
    int value;

    public ValNode(int times,int value){
        this.times = times;
        this.value = value;
    }
}


    public class Solution {





    public static void main(String[] args) {


        TreeMap<KeyNode, ValNode> treeMap = new TreeMap<>(new Comparator<KeyNode>() {
            public int compare(KeyNode n1, KeyNode n2) {
                if (n1.times < n2.times) {
                    return -1;
                } else if (n1.times > n2.times) {
                    return 1;
                } else {
                    return n1.lastTime - n2.lastTime;
                }
            }
        });

        KeyNode keyNode = new KeyNode(1,3,0);
        KeyNode keyNode1 = new KeyNode(3,2,1);
        KeyNode keyNode2 = new KeyNode(3,2,1);

        ValNode valNode = new ValNode(1,200);
        ValNode valNode1 = new ValNode(1,1);
        ValNode valNode2 = new ValNode(1,2);

//        treeMap.put(keyNode,valNode);
//        treeMap.put(keyNode1,valNode1);
       treeMap.put(keyNode2,valNode2);



//        System.out.println(treeMap.firstEntry().getKey().key);
//        System.out.println(treeMap.firstEntry().getValue().value);

        System.out.println( treeMap.get(keyNode1)==null );
        System.out.println(keyNode1.equals(keyNode2));
        System.out.println(keyNode1.hashCode()==keyNode2.hashCode());
        System.out.println("aaaaa");




    }



    }


